
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
	<title>可用可信家庭市场</title>
	<!--                       CSS                       -->
	<!-- Reset Stylesheet -->
	<link rel="stylesheet" href="/static/css/reset.css" type="text/css" media="screen" />
	<!-- Main Stylesheet -->
	<link rel="stylesheet" href="/static/css/style.css" type="text/css" media="screen" />
	<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
	<link rel="stylesheet" href="/static/css/invalid.css" type="text/css" media="screen" />
	<!--                       Javascripts                       -->
	<!-- jQuery -->
	<script type="text/javascript" src="/static/scripts/jquery-1.3.2.min.js"></script>
	<!-- jQuery Configuration -->
	<script type="text/javascript" src="/static/scripts/simpla.jquery.configuration.js"></script>
	<!-- Facebox jQuery Plugin -->
	<script type="text/javascript" src="/static/scripts/facebox.js"></script>
	<!-- jQuery WYSIWYG Plugin -->
	<script type="text/javascript" src="/static/scripts/jquery.wysiwyg.js"></script>
	<!-- jQuery Datepicker Plugin -->
	<script type="text/javascript" src="/static/scripts/jquery.datePicker.js"></script>
	<script type="text/javascript" src="/static/scripts/jquery.date.js"></script>
	<!-- jQuery -->
	<script src="bower_components/jquery/jquery.min.js"></script>
	<link rel="stylesheet" type="text/css" media="all" href="/static/css/motai.css">
	<script type="text/javascript" src="/static/js/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" charset="utf-8" src="/static/js/jquery.leanModal.min.js"></script>
	<style>
		body{
			font-family:黑体;
		}
		.tmain {
			margin-left:0px;
			width:1123px;
			text-align:center;
			background-color:#d9edf7;
			padding-left:90px;
			height:600px;
		}
		#cgmain {width:1100px;
			background-color:#d9edf7;
			height:600px;

			text-align:center;
		}
		#cgmain .cgdiv {margin-bottom:-10px;}
		
		.pihao_ul{
			list-style:none;
			border:hidden;
			background-color:#d9edf7;
		}
		.pihao_ul li {
			float:left;
			width:250px;text-align:center;line-height:33px;
			font-size:15px;
			list-style-type:none;
		}
.menu_ul ul {
			list-style-type:none;
			text-align:center;
			
		}
		.menu_ul li {
			border-left:1px solid #000;float:left;
			width:110px;height:30px;text-align:center;line-height:33px;
			font-size:15px;
			list-style-type:none;
			
		}
		.menu_ul li.b1 {border-bottom:1px solid #000;}
		.menu_ul li.r1 {border-right:1px solid #000;}
		

		.menu_ul li.cm1 {width:220px;}
		.menu_ul li.sl {width:70px;}
		.menu_ul li.sl1 {width:300px;}
		.menu_ul li.bj1 {width:70px;}
		.th1{
		border-top:1px solid #000;
		border-bottom:1px solid #000;
		}
		.menu_ul li.bz1 {width:360px;font-size:12px;}
	</style>
</head>
<body>
<div id="body-wrapper">
	<!-- Wrapper for the radial gradient background -->
	<div id="sidebar">
		<div id="sidebar-wrapper">

			<div id="profile-links">
				<!-- Logo (221px wide) -->
				<a href="#"><img id="logo" src="/static/images/logo.png" alt="Simpla Admin logo" /></a>

				{$_COOKIE['user_name']},你好 <br/>
				| <a href="/index.php/index/index/uexit" title="Sign Out">退出</a> </div>

			 <ul id="main-nav">
                <!-- Accordion Menu -->
                <!--<li> <a href="#/" class="nav-top-item no-submenu">-->
                    <!--&lt;!&ndash; Add the class "no-submenu" to menu items with no sub menu &ndash;&gt;-->
                    <!--Dashboard </a> </li>-->
               {if condition="!empty($powers['order_action'])"}
                <li> <a href="#" class="nav-top-item"> 订单操作</a>
                    <ul>
                    	
                        <li><a  href="/index.php/index/index/neworder_list">新订单</a></li>
                        <!-- Add class "current" to sub menu items also -->
                        <li><a href="/index.php/index/index/addorder">创建新订单</a></li>
                        <li><a href="/index.php/index/index/allorder_list">所有订单</a></li>
                    </ul>
                </li>
           	{/if}
           	 {if condition="!empty($powers['cg_action'])"}
                <li> <a href="#" class="nav-top-item  current"> 采购单 </a>
                    <ul>
                        <li><a href="/index.php/index/index/newcg_list">待处理 采购单</a></li>
                        <li><a class="current" href="/index.php/index/index/cg_history">采购单历史</a></li>
                    </ul>
                </li>
             {/if}
              {if condition="!empty($powers['table_action'])"}
                <li> <a href="#" class="nav-top-item"> 报表 </a>
                    <ul>
                        <li><a href="/index.php/index/biao/daybiao">日报表</a></li>
                        <li><a href="/index.php/index/biao/yuebiao">月报表</a></li>
                        <li><a href="/index.php/index/biao/nianbiao">年报表</a></li>
                    </ul>
                </li>
               {/if}
                {if condition="!empty($powers['goods_action'])"}
                <li> <a href="#" class="nav-top-item">菜品管理 </a>
                    <ul>
                        <li><a href="/index.php/index/goods/goods">所有菜品</a></li>
                        <li><a href="/index.php/index/goods/categorys">所有分类</a></li>
                    </ul>
                </li>
                {/if}
                 {if condition="!empty($powers['promotion_action'])"}
                 <li> <a href="#" class="nav-top-item"> 推广活动 </a>
                    <ul>
                        <li><a href="/index.php/index/promotion/snlist">SN优惠码</a></li>
                    </ul>
                </li>
                {/if}
                
                <li> <a href="#" class="nav-top-item"> 个人信息 </a>
                    <ul>
                        <li><a href="/index.php/index/index/user_info">查看信息</a></li>
                        <li><a href="/index.php/index/index/update_pass">修改密码</a></li>
                    </ul>
                </li>
       
                {if condition="!empty($powers['super'])"}
                 <li><a href="#" class="nav-top-item"> 用户管理 </a>
                 	<ul>
                        <li><a href="/index.php/index/admin/user_admin">用户权限</a></li>
                    </ul>
                 </li>
                {/if}

            </ul>
            <!-- End #main-nav -->
		</div>
	</div>
	<!-- End #sidebar -->
	<div id="main-content">
		<!-- Main Content Section with everything -->

		<div class="content-box">

			<!-- Start Content Box -->
			<div class="content-box-header" ><br />
				<div style="float:left; line-height:20px;font-size:14px;">
					{if condition="empty($cg_number)"}
					&nbsp;今日已打印采购单
					{else/}
					采购单查询
					{/if}
				</div>
				
				<div style="float:left; line-height:20px;font-size:14px;margin-left:20px;">
					<form action="/index.php/index/index/cg_history" method="post">
						输入采购单批号
						<input type="text"  name="cg_number" value="" />
						<button type="submit"  class="button medium back">查询</button>
					</form>
				</div>
			</div>
			<!-- End .content-box-header -->
			<div class="content-box-content">
				
							
{if condition="empty($cg_number)"}
	{if condition="!empty($cg_list)"}
	{volist name="cg_list" id="v" key="k" }
	<div class="tmain">
		<button type="button" onclick="printPage({$k},'{$v.cg_number}')" style="float:right;" class="button medium back"  data-am-modal="{target: '#doc-modal-1', closeViaDimmer: 0, width: 400, height: 225}">A4纸打印</button>
								<a href="/index.php/index/index/printcg/cg_number/{$v.cg_number}" style="float:right;" class="button medium back">超市小票纸打印</a>

					<!--startprint{$k}-->
								<div id="cgmain">
									<div class="cgdiv">
										<div style="font-size:25px;text-align:center;margin-bottom:-20px;margin-top:-10px;">采购单</div>
										<ul class="pihao_ul">
											<li>可用可信家庭市场</li>
											<li>批号：{$v.cg_number}</li>
											<li>配送日期： {$v.ps_date|date='Y-m-d',###}</li>
											<li>配送时间:
											{if condition="($v.ps_time == 9)"}9:00-10:00
											{elseif condition="$v.ps_time == 10"}10:00-11:00
											{elseif condition="$v.ps_time == 11"}11:00-12:00

											{elseif condition="$v.ps_time == 15"}15:00-16:00
											{elseif condition="$v.ps_time == 16"}16:00-17:00
											{elseif condition="$v.ps_time == 17"}17:00-18:00
											{else /}
											{/if}
											</li>
										</ul>
										
									</div>
									<div class="menu_ul">
										<ul>
											<li class="cm1 th1">菜单名</li>
											<li class="sl th1">总数量</li>
											<li class="sl1 th1">数量</li>
											<li class="bj1 th1">标价</li>
											<li class="r1 bz1 th1">备注</li>

											
											<?php $cout=0;$sum=0;?>

											{volist name="v['list']" id="vo" key="kk" }
											
											<?php $sum+=($vo['goods_price']*$vo['num']);?>
											<?php ++$cout;?>
	
											<li class="b1 cm1">{$vo.goods_name}</li>
											<li class="b1 sl">{$vo.num}</li>
											<li class="b1 sl1">{$vo.guige}</li>
											<li class="b1 bj1">{$vo.goods_price}</li>
											<li class="b1 r1 bz1">{$vo.desc}</li>

											{/volist}


										</ul>
									
									</div>
									<div class="pihao_ul">
										<ul>
											<li>总金额：{$sum} &nbsp; &nbsp;(元)</li>
											<li>确认采购:(章)</li>
											<li>采购员签名：</li>
											<li>完成时间:</li>
										</ul>	
									</div>
								</div>
								<!--endprint{$k}-->
	</div>
	<br/><br/>

	{/volist}
{/if}

{else/}
	{if condition="!empty($cg_list)"}
<div class="tmain">
<button type="button" onclick="printPage(1,'{$cg_number}')" style="float:right;" class="button medium back"  data-am-modal="{target: '#doc-modal-1', closeViaDimmer: 0, width: 400, height: 225}">A4纸打印</button>
								<a href="/index.php/index/index/printcg/cg_number/{$cg_number}" style="float:right;" class="button medium back">超市小票纸打印</a>

					<!--startprint1-->
								<div id="cgmain">
									<div class="cgdiv">
										<div style="font-size:25px;text-align:center;margin-bottom:-20px;margin-top:-10px;">采购单</div>
										<ul class="pihao_ul">
											<li>可用可信家庭市场</li>
											<li>批号：{$cg_number}</li>
											<li>配送日期： {$ps_date|date='Y-m-d',###}</li>
											<li>配送时间:
											{if condition="($ps_time == 9)"}9:00-10:00
											{elseif condition="$ps_time == 10"}10:00-11:00
											{elseif condition="$ps_time == 11"}11:00-12:00

											{elseif condition="$ps_time == 15"}15:00-16:00
											{elseif condition="$ps_time == 16"}16:00-17:00
											{elseif condition="$ps_time == 17"}17:00-18:00
											{else /}
											{/if}
											</li>
										</ul>
										
									</div>
									<div class="menu_ul">
										<ul>
											<li class="cm1 th1">菜单名</li>
											<li class="sl th1">总数量</li>
											<li class="sl1 th1">数量</li>
											<li class="bj1 th1">标价</li>
											<li class="r1 bz1 th1">备注</li>

											
											<?php $cout=0;$sum=0;?>

											{volist name="cg_list" id="vo" key="kk" }
											<?php $sum+=($vo['goods_price']*$vo['num']);?>
											<?php ++$cout;?>
	
											<li class="b1 cm1">{$vo.goods_name}</li>
											<li class="b1 sl">{$vo.num}</li>
											<li class="b1 sl1">{$vo.guige}</li>
											<li class="b1 bj1">{$vo.goods_price}</li>
											<li class="b1 r1 bz1">{$vo.desc}</li>
											{/volist}


										</ul>
									
									</div>
									<div class="pihao_ul">
										<ul>
											<li>总金额：{$sum} &nbsp; &nbsp;(元)</li>
											<li>确认采购:(章)</li>
											<li>采购员签名：</li>
											<li>完成时间:</li>
										</ul>	
									</div>
								</div>
								<!--endprint1-->
	<br/><br/>
	</div>
	{/if}



{/if}

				<!-- End #tab1 -->



			</div>
			<!-- End .content-box-content -->
		</div>
		<!-- End .content-box -->



	</div>
	<!-- End #main-content -->
</div>

<script src="http://cdn.bootcss.com/jquery/3.1.0/jquery.min.js"></script>
<script src="http://cdn.bootcss.com/amazeui/2.7.2/js/amazeui.min.js"></script>

<script src="./tpl/Hm/default/static/order/js/jquery-1.7.1.js" type="text/javascript"></script>
<script>
	function printPage(k,key,ps_date)
	{
		var bdhtml=window.document.body.innerHTML;//获取当前页面html代码
		var sprnstr= "<!--startprint"+k+"-->" ;
		var eprnstr= "<!--endprint"+k+"-->" ;
		var prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+18);
		prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
		window.document.body.innerHTML=prnhtml;
		window.print();
		window.document.body.innerHTML=bdhtml;
		$('#reids_date').val(ps_date);
		$('#reids_time').val(key);
	}


	message_tips();
	/**
	 * ajax提醒
	 **/
	a = 1;
	function fn(){

		if(a == 1){
			$('#message_tips').css({color:'white'});
			$('#message_tips2').css({color:'white'});
			a = 0;
		}else{
			$('#message_tips').css({color:'#F00'});
			$('#message_tips2').css({color:'#F00'});
			a = 1;
		}
	}
	var myInterval;
	function message_tips(){
		$.get("/index.php/index/index/tips", function(data){
			if(data != $('#message_tips').html()){
				$('#message_tips').css({color:'#F00'});
				myInterval = setInterval(fn,5000);
				$('#message_tips2').css({color:'#F00'});
				$("#message_audio").html("<audio id='ttsoundplayer'  autoplay='autoplay'><source src='/static/sound/1583.wav' type='audio/wav'></audio>");

			} else {
				$("#message_audio").html('');
				if(data == 0){
					$('#message_tips').css({color:'#000'});
					clearInterval(myInterval);
				}
			}

			$('#message_tips').html(data);
			$('#message_tips2').html(data);
		},'json');
		setTimeout('message_tips()',10000);
	}



</script>

<!-- won模态框（Modal） -->
<div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-1" style="display:none;">
	<div class="am-modal-dialog">
		<div class="am-modal-hd">是否打印成功？
			<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
		</div>
		<div class="am-modal-bd">
			打印成功后，此页面将不再显示该采购表<br/><br/>
			<form method="post" action="/index.php/index/index/printcg_success">
				<input type="hidden" name="ps_date" value="" id="reids_date"/>
				<input type="hidden" name="ps_time" value="" id="reids_time"/>
				<button type="submit" class="submit btn btn-primary">
					确定已打印
				</button>
			</form>
		</div>
	</div>
</div>
<!-- won模态框（Modal） -->
</body>
</html>
